package com.ywx.yypicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ywx.yypicturebackend.model.dto.space.SpaceAddRequest;
import com.ywx.yypicturebackend.model.dto.space.SpaceQueryRequest;
import com.ywx.yypicturebackend.model.entity.Space;
import com.ywx.yypicturebackend.model.entity.User;
import com.ywx.yypicturebackend.model.vo.SpaceVO;


import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author ywx
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-05-21 10:41:14
*/
public interface SpaceService extends IService<Space> {


    /**
     * 创建空间
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 获取空间分页查询条件对象
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);


    /**
     * 获取单个空间的封装
     * @param space
     * @param request
     * @return
     */
   SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 将空间分页结果转换成空间封装类的分页结果
     * @param spacePage
     * @param request
     * @return
     */
    public Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);


    /**
     * 空间数据校验
     * @param space
     */
    public void validSpace(Space space,Boolean add);


    /**
     * 填充空间等级属性
     * @param space
     */
    public void fillSpaceBySpaceLevel(Space space);

    /**
     * 删除空间里的所有图片
     * @param spaceId
     */
    public void deletePictureBySpaceId(Long spaceId);


    /**
     * 校验空间权限
     * @param space
     * @param loginUser
     */
    public void checkSpaceAuth(Space space,User loginUser);

}
